﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;



namespace RN.ERP.DAL
{
    public class KaoHeDAL
    {
        private QD_Context qdcontext = new QD_Context();

        public Dictionary<string, double> GetCorpDeDuckList(string corpGuids, string areaCode)
        {
            string sql = String.Format(@"SELECT CorpUserGuid, SUM(score) as SumScore  
                                         from v_e_DeDuck    
                                         where CorpUserGuid in ({0}) 
                                         AND bFlowStatus  like '1,%'   
                                         GROUP BY CorpUserGuid ", corpGuids);

            return qdcontext.Database.SqlQuery<RN.ERP.Entity.KeyValue>(sql).ToDictionary(a => a.Key, a => double.Parse(a.Value));

        }
    }
}
